home *** CD-ROM | disk | FTP | other *** search
/ CICA 1997 August / CICA - The Ultimate Collection of Shareware for Windows (Walnut Creek) (August 1997) (Disc 1).iso / utils / unix / unzip520 / wingui / password.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-22  |  1.9 KB  |  67 lines

  1. #include <windows.h>
  2.  
  3. #define UNZIP_INTERNAL
  4. #include "unzip.h"
  5. #include "crypt.h"
  6.  
  7. #include "wingui\wizunzip.h"
  8. #include "wingui\password.h"
  9. #include "wingui\helpids.h"
  10.  
  11. /****************************************************************************
  12.  
  13.     FUNCTION: PasswordProc(HWND, WORD, WPARAM, LPARAM)
  14.  
  15.     PURPOSE:  Processes messages for "Password" dialog box
  16.  
  17.     MESSAGES:
  18.  
  19.     WM_INITDIALOG - initialize dialog box
  20.     WM_COMMAND    - Input received
  21.  
  22. ****************************************************************************/
  23. BOOL WINAPI PasswordProc(HWND hDlg, WORD wMessage, WPARAM wParam, LPARAM lParam)
  24. {
  25. static char __far *lpsz;
  26.  
  27.     switch (wMessage)
  28.     {
  29.     case WM_INITDIALOG:
  30.         lpsz = (char __far *)lParam;
  31.         if (lpumb->szBuffer[0] != ' ')
  32.            {
  33.            SetDlgItemText(hDlg, IDM_PASSWORD_INCORRECT, "Incorrect Password");
  34.            }
  35.         else
  36.            SetDlgItemText(hDlg, IDM_PASSWORD_INCORRECT, "");
  37.  
  38.         wsprintf(lpumb->szBuffer, "Enter Password for %s", (LPSTR)lParam);
  39.         SetDlgItemText(hDlg, IDM_PASSWORD_TEXT, lpumb->szBuffer);
  40.         SetDlgItemText(hDlg, IDM_NEW_PASSWORD_NAME_TEXT, "");
  41.         CenterDialog(GetParent(hDlg), hDlg); /* center on parent */
  42.         return TRUE;
  43.  
  44.     case WM_SETFOCUS:
  45.         SetFocus(GetDlgItem(hDlg, IDM_NEW_PASSWORD_NAME_TEXT));
  46.         return TRUE;
  47.  
  48.     case WM_COMMAND:
  49.         switch (LOWORD(wParam))
  50.         {
  51.         case IDM_PASSWORD_RENAME:
  52.             GetDlgItemText(hDlg, IDM_NEW_PASSWORD_NAME_TEXT, lpumb->lpPassword, 80);
  53.             EndDialog(hDlg, wParam);
  54.             break;
  55.         case IDM_PASSWORD_CANCEL:
  56.             lpumb->szPassword[0] = '\0';
  57.             EndDialog(hDlg, wParam);
  58.             break;
  59.         case IDM_PASSWORD_HELP:
  60.             WinHelp(hDlg,szHelpFileName,HELP_CONTEXT, (DWORD)(HELPID_PASSWORD));
  61.         }
  62.         return TRUE;
  63.     }
  64.     return FALSE;
  65. }
  66.  
  67.